//
//  WZGReChargePopVC.m
//  ZCJZ
//
//  Created by sujeking on 2019/9/4.
//  Copyright © 2019 jeking. All rights reserved.
//

#import "WZGPaySuccessPopVC.h"
#import <BlocksKit+UIKit.h>
#import "TBCityIconFont.h"

@interface WZGPaySuccessPopVC ()

@property (weak, nonatomic) IBOutlet UILabel *amountLabel;
@property (weak, nonatomic) IBOutlet UIButton *getBtn;
@property (weak, nonatomic) IBOutlet UIButton *closeBtn;
@property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;

@end

@implementation WZGPaySuccessPopVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
}

- (void)setupUI {
    self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    CAGradientLayer *gLayer = [CAGradientLayer layer];
    gLayer.frame = self.getBtn.bounds;
    gLayer.colors = @[(__bridge id)[generalToolBox getColorWithHexadecimalColorStr:@"0xF9E07E"].CGColor,
                      (__bridge id)[generalToolBox getColorWithHexadecimalColorStr:@"0xEFBA41"].CGColor,];
    gLayer.startPoint = CGPointMake(0, 0);
    gLayer.endPoint   = CGPointMake(0, 1);
    [self.getBtn.layer insertSublayer:gLayer atIndex:0];
    
    UIImage *img = [UIImage iconWithInfo:TBCityIconInfoMake(@"\U0000e679", 25, [generalToolBox getColorWithHexadecimalColorStr:@"0xffffff"])];
    [self.closeBtn setTitle:nil forState:UIControlStateNormal];
    [self.closeBtn setImage:img forState:UIControlStateNormal];
    self.closeBtn.transform = CGAffineTransformMakeRotation(M_PI_4);
    
    [self.closeBtn bk_addEventHandler:^(id sender) {
        [self dismissViewControllerAnimated:YES completion:nil];
    } forControlEvents:UIControlEventTouchUpInside];
    
    self.getBtn.layer.cornerRadius = CGRectGetHeight(self.getBtn.bounds) / 2;
    self.getBtn.layer.masksToBounds = YES;
    
    self.amountLabel.text = [NSString stringWithFormat:@"%.2f",self.amountstr.floatValue];
    self.subTitleLabel.text = self.subtitle ? self.subtitle :@"部分商品可用";
}

@end
